/**
 * ****************************************************************************
 * Project: RoboBridge
 * ----------------------------------------------------------------------------
 * -------------------------- [c]2012 - KrawallMann ---------------------------
 * ---------------------- http://www.krawallmann.de.tc/ -----------------------
 * ****************************************************************************
 * File: AbstractRoboViewDisplay.java Package:
 * tc.de.krawallmann.robobridge.visualization Version: 1.0 Author(s):
 * KrawallMann
 * ****************************************************************************
 * Description:
 * ****************************************************************************
 */
package tc.de.krawallmann.robobridge.visualization;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.TexturePaint;
import java.awt.image.BufferedImage;

import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

import eu.hansolo.steelseries.tools.BackgroundImageFactory;

import tc.de.krawallmann.robobridge.devices.SensorListener;

/**
 * The Class AbstractRoboViewDisplay.<br/>
 * Partially auto-generated Javadoc!
 */
public abstract class AbstractRoboViewDisplay extends JInternalFrame implements SensorListener {

	public AbstractRoboViewDisplay(String title, boolean resizable, boolean closable, boolean maximizable,
			boolean iconifiable) {
		super(title, resizable, closable, maximizable, iconifiable);
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);


		JPanel panel = new JPanel() {
            @Override
            public void paintComponent(Graphics g) {
            	Graphics2D g2 = (Graphics2D) g;
            	Paint p = g2.getPaint();
            	BufferedImage img=BackgroundImageFactory.INSTANCE.CARBON_FIBRE_TEXTURE;
            	g2.setPaint(new TexturePaint(img, new Rectangle(0,0,img.getWidth(), img.getHeight())));
                g2.fillRect(0, 0, getWidth(), getHeight());
                g2.setPaint(p);
                paintChildren(g);
            }
        };
        this.setContentPane(panel);
	}

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 4759262048717676034L;

	/**
	 * Instantiates a new abstract robo view display.
	 * 
	 * @param title
	 *            the title
	 */
	public AbstractRoboViewDisplay(final String title) {
		this(title, false, true, false, true);
	}

}
